package com.boot2.core.dict;

/**
 * 任务调度
 * 
 * @description:
 * @CreateDate:2018年3月14日 下午2:06:00
 * @Author:zhangweilin
 */
public class SchedulerEnum {

	/**
	 * 重复规则
	 * 
	 * @description:
	 * @CreateDate:2018年3月14日 下午2:16:12
	 * @Author:zhangweilin
	 */
	public static enum LoopRule {
		OneTime(0, "只执行一次 "),
		EveryDay(1, "每天"),
		Workday(2, "法定工作日"),
		Holiday(3, "法定休息日"),
		Week1To5(4, "周一到周五"),
		Week67(5, "周六周日"),
		Week(6, "按星期自定义.，");

		private int index;
		private String name;

		private LoopRule(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static LoopRule get(int index) {
			for (LoopRule c : LoopRule.values()) {
				if (c.getIndex() == index) {
					return c;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public int getIndex() {
			return index;
		}
	}

	/**
	 * 类型
	 * 
	 * @description:
	 * @CreateDate:2018年3月14日 下午2:31:18
	 * @Author:zhangweilin
	 */
	public static enum Type {
		Device(1, "单个设备"),
		DeviceGroup(2, "设备组");

		private int index;
		private String name;

		private Type(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static Type get(int index) {
			for (Type c : Type.values()) {
				if (c.getIndex() == index) {
					return c;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public int getIndex() {
			return index;
		}
	}

	/**
	 * 级别
	 * 
	 * @description:
	 * @CreateDate:2018年3月14日 下午2:31:18
	 * @Author:zhangweilin
	 */
	public static enum Level {
		Base(1, "基本"),
		Advance(2, "高级");

		private int index;
		private String name;

		private Level(int index, String name) {
			this.index = index;
			this.name = name;
		}

		public static Level get(int index) {
			for (Level c : Level.values()) {
				if (c.getIndex() == index) {
					return c;
				}
			}
			return null;
		}

		public String getName() {
			return name;
		}

		public int getIndex() {
			return index;
		}
	}
}
